{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[array([[[ 0],\n",
       "         [ 2],\n",
       "         [ 4],\n",
       "         [ 6],\n",
       "         [ 8]],\n",
       " \n",
       "        [[ 2],\n",
       "         [ 4],\n",
       "         [ 6],\n",
       "         [ 8],\n",
       "         [10]]]),\n",
       " array([[[ 1],\n",
       "         [ 3],\n",
       "         [ 5],\n",
       "         [ 7],\n",
       "         [ 9]],\n",
       " \n",
       "        [[ 3],\n",
       "         [ 5],\n",
       "         [ 7],\n",
       "         [ 9],\n",
       "         [11]]])]"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.split(arr,2,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr = np.array([[[ 0,  1],[ 2,  3],[ 4,  5],[ 6,  7],[ 8,  9]],\n",
    "                [[ 2,  3],[ 4,  5],[ 6,  7],[ 8,  9],[10, 11]]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[ True,  True],\n",
       "        [ True,  True],\n",
       "        [ True,  True],\n",
       "        [ True,  True],\n",
       "        [ True,  True]]])"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr1,arr2,arr3 = np.vsplit(arr,[1,2])\n",
    "arr1 == arr[:1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[[0, 1],\n",
       "         [2, 3],\n",
       "         [4, 5],\n",
       "         [6, 7],\n",
       "         [8, 9]]]),\n",
       " array([[[ 2,  3],\n",
       "         [ 4,  5],\n",
       "         [ 6,  7],\n",
       "         [ 8,  9],\n",
       "         [10, 11]]]),\n",
       " array([], shape=(0, 5, 2), dtype=int32))"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[:1],arr[1:2],arr[2:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[array([0]), array([1]), array([2]), array([3]), array([4])]\n"
     ]
    }
   ],
   "source": [
    "arr = np.array([0,1,2,3,4])\n",
    "print(np.hsplit(arr,5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((2, 5, 1), (2, 5, 1))"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr = np.array([[[ 0,  1],[ 2,  3],[ 4,  5],[ 6,  7],[ 8,  9]],\n",
    "                [[ 2,  3],[ 4,  5],[ 6,  7],[ 8,  9],[10, 11]]])\n",
    "arr1,arr2 = np.dsplit(arr,2) #深度分割\n",
    "arr1.shape,arr2.shape  #(2, 5, 1), (2, 5, 1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
